<?php
namespace app\validate;
use share\validate\SceneValidate;

class P2pUpgradeSelectorValidate extends SceneValidate{

    /**
     * 通用规则
     */
    protected $rule = [
        'id' => 'require|integer',
        'name' => 'require|length:1,50',
        'dn' => 'require|length:1,50',
        'sn' => 'require|length:1,50',
        'pk' => 'require|length:1,50',
        'p2p_upgrade_conf_id' => 'require|integer|>=:1',
    ];    

    /**
     * 自定义场景的规则
     */
    protected $sceneRules = [
        'list' =>[
            'name' => 'length:1,50',
            'dn' => 'length:1,50',
            'sn' => 'length:1,50',
            'pk' => 'length:1,50',
            'p2p_upgrade_conf_id' => 'integer',
        ],
        'check' => [
            'dn' => 'length:1,50',
            'sn' => 'length:1,50',
            'pk' => 'length:1,50',
        ],
    ];

    protected $scene = [
        'list' => ['name','dn','sn','pk','p2p_upgrade_conf_id'],
        'set' => ['id','name','dn','sn','pk','p2p_upgrade_conf_id'],
        'del'  => ['id'],
        'check' => ['dn','sn','pk'],
    ];
}
